In recent years, a method of encoding an image with markedly improved coding efficiency is recommended as ITU-T FEC. H.264 and ISO/IEC 14496-10 (hereinafter, referred to as “H.264”) in cooperation of ITU-T (International Telecommunication Union Telecommunication Standardization Sector) and ISO (International Organization for Standardization)/IEC (International Electrotechnical Commission).
In H.264, an inter-prediction coding system is disclosed in which redundancy in the time direction is eliminated to achieve high coding efficiency by making a motion compensation prediction of fractional precision using a coded image as a reference image.
In addition, a system is proposed in which a moving image including a fading or dissolving effect is encoded with efficiency higher than that of an inter-prediction coding system according to ISO/IEC MPEG (Moving Picture Experts Group)-1, 2, 4. In this system, a motion compensation prediction of fractional precision is made for an input moving image having luminance and two color differences as frames for predicting a change in the brightness in the time direction. Then, by using an index representing a combination of a reference image, a weighting factor for each luminance and two color differences, and an offset for each luminance and two color differences, a predicted image is multiplied by the weighting factor, and the offset is added thereto.
However, in the technology of the related art as described above, in a bidirectional prediction slice in which bi-directional predictions can be selected, when weighted motion compensation is performed using two indices having the same reference image but having different reference image numbers different from each other, there are cases where an index having the same value is encoded twice, and accordingly, there are cases where the coding efficiency decreases. An object of the present invention is to provide an encoding method and a decoding method capable of improving the coding efficiency.